package androidserver.engine;

import java.rmi.*;
import java.rmi.server.*;

import androidserver.matlabprocessor.MatlabRemote;
import androidserver.matlabprocessor.compute.*;
import androidserver.matlabprocessor.matlabcontrol.MatlabConnectionException;
import androidserver.matlabprocessor.remote.IMatlabRemote;

public class MatlabEngine extends UnicastRemoteObject implements IMatlabRemote {
	private static final long serialVersionUID = -1132699596203070577L;
	
	private MatlabRemote matlabRemote;

	public MatlabEngine() throws RemoteException {
		super();
		try {
			matlabRemote = new MatlabRemote();
		} catch (MatlabConnectionException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public String processMatlabQuery(String command, int returnCount)
			throws RemoteException {
		try {
			System.out.println("thread elott");
			Thread.currentThread().sleep(2000);
			System.out.println("thread utan");
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		command = "main('/home/aron/allamvizsga/amatlab_prototype/inputimg/uspsinput.png')";
		String ret = matlabRemote.processMatlabRequest(command, returnCount);
		System.out.println("retval test - " + ret);
		return ret;
	}
}